package com.fstec.ks.master.dao.jdbc.extractor;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import com.fstec.ks.master.vo.RoomRoundVO;

/**
 * 考场场次监测信息字段Extractor类
 * @Title RoomRoundExtractor.java
 * @Package com.fstec.ks.master.dao.jdbc.extractor
 * @Description 
 * Copyright: Copyright (c) 2017
 * Company:北京信诺软通
 *
 * @author <a href="mailto:zhkuqijin@163.com">谢启进</a>
 * @date 2023年10月06日 下午14:37:34
 * @version V1.0
 */
public class RoomRoundExtractor implements ResultSetExtractor<List<RoomRoundVO>> {
	/**
	 * 查询字段
	 * 
	 * @return
	 * @auth <a href="mailto:liyunfeng@sinotn.com">李云峰</a>
	 * @date 2017年3月6日 下午3:27:25
	 */
	public static String getColumns() {
		return "id,round_begin_time,round_end_time,examinee_count,exam_server_id,room_id,room_name,login_count,submit_count,client_open_count,invigilator_status";
	}

	/*
	 * @see org.springframework.jdbc.core.ResultSetExtractor#extractData(java.sql.ResultSet)
	 */
	@Override
	public List<RoomRoundVO> extractData(ResultSet rs) throws SQLException, DataAccessException {
		ArrayList<RoomRoundVO> list = new ArrayList<RoomRoundVO>();
		RoomRoundVO vo = null;
		while(rs.next()) {
			vo = new RoomRoundVO();
			vo.setId(rs.getString(1));
			vo.setRoundBeginTime(new Date(rs.getLong(2)));
			vo.setRoundEndTime(new Date(rs.getLong(3)));
			vo.setExamineeCount(rs.getInt(4));
			vo.setExamServerId(rs.getString(5));
			vo.setRoomId(rs.getString(6));
			vo.setRoomName(rs.getString(7));
			vo.setLoginCount(rs.getInt(8));
			vo.setSubmitCount(rs.getInt(9));
			vo.setClientOpenCount(rs.getInt(10));
			vo.setInvigilatorStatus(rs.getInt(11));
			list.add(vo);
		}
		return list;
	}
}
